# Contributor: Alex Yam <alex@alexyam.com>
# Maintainer: Alex Yam <alex@alexyam.com>
pkgname=cln
pkgver=1.3.7
pkgrel=0
pkgdesc="C++ class library for numbers"
url="https://www.ginac.de/CLN/"
arch="all"
license="GPL-2.0-or-later"
makedepends="gmp-dev"
subpackages="$pkgname-dev $pkgname-doc"
source="https://www.ginac.de/CLN/cln-$pkgver.tar.bz2"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--with-gmp
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	cd ./doc && mkdir -pv "$pkgdir"/usr/share/doc/cln/examples  && \
	cp -rpv ./cln.texi "$pkgdir"/usr/share/doc/cln/
	cd ../examples && rm -rv ./Make* \
		contfrac e fibonacci legendre lucaslehmer nextprime perfnum pi \
		contfrac.o e.o fibonacci.o legendre.o lucaslehmer.o nextprime.o perfnum.o pi.o && \
	cp -rpv ./* "$pkgdir"/usr/share/doc/cln/examples
}

sha512sums="
39abfae41504030cce16d0ed0547eafaa9a819f1225289d262cdd8e50d9af5bdb695d6e5a7f4b3577af29bedaf2e31700655b07a624b4232aecf8d795f697a1b  cln-1.3.7.tar.bz2
"
